<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page import="com.serviceprovider.business.utility.SecurityContextUser"%>
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<%@include file="/WEB-INF/taglibs/common/taglibs.jsp"%>

<head>
<title><spring:message code="sp.allfeesreports.title" /></title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link  rel="stylesheet" href="<c:url value="/css/styles.css"/>"/>
<link  rel="stylesheet" href="<c:url value="/javascripts/jscalendar/theme/calendar-system.css"/>"/>
<script src="<c:url value="/javascripts/jscalendar/calendar-cfg.js"/>"  type="text/javascript"></script>
<script src="<c:url value="/javascripts/calendar.js"/>"  type="text/javascript"></script>
<script src="<c:url value="/javascripts/jscalendar/lang/calendar-en.js"/>"  type="text/javascript"></script>
<script src="<c:url value="/javascripts/jscalendar/calendar-setup.js"/>"  type="text/javascript"></script>

<script src="<c:url value="/javascripts/common.js"/>" type="text/javascript">
</script>
</head>
<body><div class="page">
<%
    Object isAdmin = SecurityContextUser.isAdmin();
    if(Boolean.TRUE.equals(isAdmin)){
        %>
            <%@include file="../../admin/top_menu.jsp"%>
        <%
    } else{
        %>
            <%@include file="../top_menu.jsp"%>
        <%
    }
    %>
<table width=100%>
	<tr>
		<td><%@include file="/WEB-INF/jsp/include/messages.jsp"%>
		<br />
		</td>
	</tr>

</table>
	<table border="0" cellpadding="0" cellspacing="0" width="100%">		
			<tr>
				<td><h4><spring:message code="sp.allfeesreports.label.standardreportview" /></h4></td>
				<td align="right">
					<span><a href="../../users/view_user_details.htm?id=${level1userid}">${level1userid}</a></span>
					<span><a href="../../users/view_user_details.htm?id=${level1userid}">${level1username}</a></span>
				</td>
			</tr>
	</table>
	<c:import url="select_report.jsp" />

    <div class="table_title" style="background: none;"><spring:message code="sp.allfeesreports.label.allfeesreport" /></div>
    <div class="" align="right" style="background: none;">
    	
    </div>
    <c:forEach var="batchRecord" items="${reportData.batchRecords}">
        <table border=0 cellpadding=4 cellspacing=1 width=100%>
            <tr><td colspan="${reportData.feeNameSize + 9 + batchRecord.allPayeesSize}" class="table_title"><spring:message code="sp.allfeesreports.label.batch" /> #${batchRecord.batch.id} - <fmt:formatDate pattern="MMM dd yyyy hh:mm" value="${batchRecord.batch.batchDate}" /></td></tr>
            <tr>
                <th><spring:message code="sp.allfeesreports.label.ser" /></th>
                <th><spring:message code="sp.allfeesreports.label.ssn" /></th>
                <th><spring:message code="sp.allfeesreports.label.customername" /></th>
                <th><spring:message code="sp.allfeesreports.label.amountreceived" /></th>
                <th><spring:message code="sp.allfeesreports.label.customerbalance" /></th>
                <th><spring:message code="sp.allfeesreports.label.svcfee" /></th>
                <th>${batchRecord.batch.customLabelName1}</th>
                <th>${batchRecord.batch.customLabelName2}</th> 
    
                <c:forEach var="feeName" items="${reportData.feeNames}">
                    <th>
                        <fmt:message key="TransactionDetail.${feeName}" />
                    </th>
                </c:forEach>
                <c:forEach var="payee" items="${batchRecord.allPayees}">
                    <th>${payee.fullName}</th>
                </c:forEach>
                <th><spring:message code="sp.allfeesreports.label.total" /></th>
            </tr>
                
            <c:forEach var="record" items="${batchRecord.transactionRecords}" varStatus="i">
                <tr>
                    <td>${i.index+1}</td>
                    <td>${record.customerSSN}</td>
                    <td>${record.customerName}</td>
                    <td><fmt:formatNumber pattern="${currenyPattern}" value="${record.amount}" /></td>
                    <td><fmt:formatNumber pattern="${currenyPattern}" value="${record.customerBalance}" /></td>
                    <td><fmt:formatNumber pattern="${currenyPattern}" value="${record.serviceFee}" /></td>
                    <!-- Added to show custom labels - start -->
                    <td><fmt:formatNumber pattern="${currenyPattern}" value="${record.customLabel1}" /></td>
                    <td><fmt:formatNumber pattern="${currenyPattern}" value="${record.customLabel2}" /></td>
                    <!-- Added to show custom labels - end -->
                    <c:forEach var="feeName" items="${reportData.feeNames}">
                        <td><fmt:formatNumber pattern="${currenyPattern}" value="${record.fees[feeName]}" /></td>  
                    </c:forEach>
                    <c:forEach var="payee" items="${batchRecord.allPayees}">
                        <td><fmt:formatNumber pattern="${currenyPattern}" value="${record.amountOfUser[payee.id]}" /></td>
                    </c:forEach>
                    <td><fmt:formatNumber pattern="${currenyPattern}" value="${record.totalFee}" /></td>
                </tr>
            </c:forEach>
            <tr>
                 <td colspan="${reportData.feeNameSize + 9 + batchRecord.allPayeesSize}"><hr/></td>
            </tr>
            <tr>
                 <td colspan="3" align="right" class="totals"><spring:message code="sp.allfeesreports.label.totals" />:</td>
                 <td class="totals"><fmt:formatNumber pattern="${currenyPattern}" value="${batchRecord.totalAmount}" /></td>
                 <td class="totals"><fmt:formatNumber pattern="${currenyPattern}" value="${batchRecord.totalCustomerBalance}" /></td>
                 <td class="totals"><fmt:formatNumber pattern="${currenyPattern}" value="${batchRecord.totalServiceFee}" /></td>
                 <c:forEach var="feeName" items="${reportData.feeNames}">
                    <td class="totals"><fmt:formatNumber pattern="${currenyPattern}" value="${batchRecord.totalFeeInBatch[feeName]}" /></td>   
                 </c:forEach>
                 <c:forEach var="amount" items="${batchRecord.totalPayeeAmounts}">
                    <td class="totals"><fmt:formatNumber pattern="${currenyPattern}" value="${amount}" /></td>   
                 </c:forEach>
                 <td class="totals"><fmt:formatNumber pattern="${currenyPattern}" value="${batchRecord.totalFee}" /></td>
            </tr>
       </table><br/>
    </c:forEach>
</div>
<%@include file="/WEB-INF/jsp/include/footer.jsp"%></body>

</html>
